package com.lancoo.cvas.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lancoo.cvas.entity.Student;
import com.lancoo.cvas.entity.TeachingClassStudent;
import com.lancoo.cvas.pojo.common.PageInfo;
import com.lancoo.cvas.pojo.dto.CacheTeachingClassDto;
import com.lancoo.cvas.pojo.response.basicPlatform.BaseStudent;
import com.lancoo.cvas.pojo.vo.*;

import javax.servlet.http.HttpServletResponse;
import javax.swing.*;
import java.util.List;

/**
 * 学生
 *
 * @author liufeng
 * @email 1037383243@qq.com
 * @date 2023-12-04 11:54:00
 */
public interface StudentService extends IService<Student> {


    void syncBaseStudent(Integer taskId, List<BaseStudent> list);

    /**
     * 根据基础平台id/学号获取学生详情
     *
     * @param taskId
     * @param baseStudentId
     * @return
     */
    Student getStudentByBaseStudentId(Integer taskId, String baseStudentId);

    /**
     * 获取学生可选的教学班课程 已选教学班 选课要求
     *
     * @param getAvailableCondition
     * @return
     */
    StudentTeachingClassView getAvailableTeachingClass(GetAvailableCondition getAvailableCondition);

    /**
     * 学生选课 使用reids lua脚本
     *
     * @param addSelectCourse
     * @return
     */
    int selectCourseOptimize(AddSelectCourse addSelectCourse);

    /**
     * 获取学生 无需选课的课程 环节 教学班
     *
     * @param taskId
     * @param studentId
     * @return
     */
    List<StudentTeachingClass> getNormalTeachingClass(Integer taskId, Long studentId);

    /**
     * 同步redis选课数据
     *
     * @param taskId
     * @return
     */
    Boolean syncTeachingClassStudent(Integer taskId);

    /**
     * 根据教学班id获取学生
     *
     * @param page
     * @param teachingClassId
     * @return
     */
    PageInfo<Student> getStudentsByTeachingClassId(Page<Student> page, Long teachingClassId);

    /**
     * 清空学生对应教学班缓存
     *
     * @param taskId
     * @param courseId
     * @param studyNature
     * @param teachingClassId
     * @return
     */
    Boolean clearCacheByTeachingClass(Integer taskId, CacheTeachingClassDto cacheTeachingClassDto);

    /**
     * 批量设置教学班学生<只在线选课使用>
     *
     * @param batchSetStudent
     * @return
     */
    List<TeachingClassStudent>  batchAddStudent(BatchSetStudent batchSetStudent);

    /**
     * 学生退选 lua脚本实现
     *
     * @param addCancelCourse
     * @return
     */
    int cancelCourseOptimize(AddCancelCourse addCancelCourse);

    /**
     * 获取[在线选课]退选学生列表
     *
     * @param taskId
     * @param page
     * @param majorId
     * @param gradeId
     * @param classId
     * @param keyWord
     * @return
     */
    PageInfo<StudentCourseVo> getDeselectStudent(Integer taskId, IPage page, String majorId, String gradeId, String classId, String keyWord);

    /**
     *条件获取全部学生
     * @param taskId
     * @param page
     * @param majorId
     * @param gradeId
     * @param classId
     * @param keyWord
     * @return
     */
    PageInfo<Student> getStudentByConditions(Integer taskId, IPage page, String gradeId, String classId, String keyWord);

    /**
     *退选
     * @param taskId
     * @param studentId
     * @param teachingClassId
     * @param flag
     * @return
     */
    int cancelCourse(Integer taskId, Long studentId, Long teachingClassId, Integer flag);

    /**
     * 根据学生id获取已选课程
     * @param taskId
     * @param studentId
     * @param teachingClassType
     * @return
     */
    List<StudentTeachingClass> getSelectedByStudentId(Integer taskId, Long studentId, Integer teachingClassType);


    /**
     * 根据获取学生列表
     * @param taskId
     * @param teachingClassId
     * @return
     */
    List<StudentByClass> getStudentListByTeachingClassId(Integer taskId, Long teachingClassId);


    /**
     * 导出退选结果
     * @param response
     * @param taskId
     * @param majorId
     * @param majorName
     * @param gradeId
     * @param gradeName
     * @param classId
     * @param className
     * @param keyWord
     * @param currentPage
     * @param pageSize
     * @return
     */
    void deselectStudentToExcel(HttpServletResponse response, Integer taskId, String majorId, String majorName, String gradeId, String gradeName, String classId, String className, String keyWord, Integer currentPage, Integer pageSize);


    /**
     * 获取班级信息
     * @param taskId
     * @return
     */
    List<BaseClassInfoDto> getClassDto(Integer taskId);

    List<CourseTypeDto> getCourseTypeByTaskId(Integer taskId, Long studentId,String baseStudentId);

    /**
     * 更新重修学生
     * @param taskId
     * @return
     */
    String updateIsRetake(Integer taskId);
}

